package com.hu.service.Impl;

import com.hu.mapper.EntryScoreMapper;
import com.hu.mapper.UniversityMapper;
import com.hu.pojo.EntryScore;
import com.hu.service.EntryScoreService;
import com.hu.vo.EntryScoreLineVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ZhouKai
 * 2022/4/23 20:08
 */
@Service
public class EntryScoreServiceImpl implements EntryScoreService {

    @Autowired
    EntryScoreMapper entryScoreMapper;
    @Autowired
    UniversityMapper universityMapper;

    /**
     * 获取院校录取分数线
     *
     * @param schoolId 院校代码
     * @return 院校录取分数线信息
     */
    @Override
    public EntryScoreLineVo getEntryScoreLineVo(Integer schoolId) {
        List<EntryScore> entryScores = entryScoreMapper.getEntryScore(schoolId);
        String schoolName = universityMapper.getUniversityById(schoolId).getSchoolName();
        return new EntryScoreLineVo(schoolName, entryScores);
    }
}
